import pymysql
import pandas as pd
from sqlalchemy import create_engine

mysql_setting = {
    'host': 'localhost',
    'port': 3306,
    'user': 'root',
    'passwd': '459gjy217',
    'db': 'test',
    'charset': 'utf8'
}
table_name = '常规赛'
path = r'D:\g\python\ti\JordanD.csv'
data = pd.read_csv(path, encoding='utf8')
# print(data)
engine = create_engine("mysql+pymysql://{user}:{passwd}@{host}:{port}/{db}".format(**mysql_setting))
data.to_sql(table_name, engine, index=False, if_exists='replace')
print('导入成功...')
